package com.net.xpay.stat.scheduler;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * 2019/4/11 12:13

 * SUN,MON,TUE,WED,THU,FRI,SAT
 * 不配置的话 定时器的线程池默认只有一个线程
 */
@Configuration
public class SchedulerConfiguration {

    @Bean
    public TaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
        taskScheduler.setThreadNamePrefix("stat-scheduler-");
        taskScheduler.setPoolSize(50);
        return taskScheduler;
    }
}
